package com.example.demo;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author caiwl
 * @date 2020/4/27 16:47
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Bean
    public RedisSessionInterceptor redisSessionInterceptor() {
        return new RedisSessionInterceptor();
    }
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(redisSessionInterceptor()).addPathPatterns("/**");
    }
}
